package cn.wolfcode.feign;

import cn.wolfcode.common.web.Result;
import cn.wolfcode.domain.Product;
import cn.wolfcode.feign.fallback.ProductFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.ArrayList;
import java.util.List;

/**
 * 远程调用商品服务
 */
@FeignClient(name = "product-service",fallback = ProductFallBack.class)
public interface ProductApi {
    //根据商品id集合，查询出商品集合
    @RequestMapping("/product/getProducts")
    Result<List<Product>> getProducts(@RequestParam("ids") List<Long> ids);
    //根据商品id,查询对应商品
    @RequestMapping("/product/getProduct")
    Result<Product> getProductById(@RequestParam("id") Long id);
}
